home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / mfb / RCS / fastblt.h,v < prev    next >
Encoding:
Text File  |  1990-02-15  |  1.9 KB  |  91 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     90.02.14.19.57.48;  author tve;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Original X11R4 distribution
  17. @
  18.  
  19.  
  20.  
  21. 1.1
  22. log
  23. @Initial revision
  24. @
  25. text
  26. @/*
  27.  * Fast bitblt macros for certain hardware.  If your machine has an addressing
  28.  * mode of small constant + register, you'll probably want this magic specific
  29.  * code.  It's 25% faster for the R2000.  I haven't studied the Sparc
  30.  * instruction set, but I suspect it also has this addressing mode.  Also,
  31.  * unrolling the loop by 32 is possibly excessive for mfb. The number of times
  32.  * the loop is actually looped through is pretty small.
  33.  */
  34.  
  35. /*
  36.  * WARNING:  These macros make *a lot* of assumptions about
  37.  * the environment they are invoked in.  Plenty of implicit
  38.  * arguments, lots of side effects.  Don't use them casually.
  39.  */
  40.  
  41. #define SwitchOdd(n) case n: BodyOdd(n)
  42. #define SwitchEven(n) case n: BodyEven(n)
  43.  
  44. /* to allow mfb and cfb to share code... */
  45. #ifndef BitRight
  46. #define BitRight(a,b) SCRRIGHT(a,b)
  47. #define BitLeft(a,b) SCRLEFT(a,b)
  48. #endif
  49.  
  50. #ifdef LARGE_INSTRUCTION_CACHE
  51. #define UNROLL 8
  52. #define PackedLoop \
  53.     switch (nl & (UNROLL-1)) { \
  54.     SwitchOdd( 7) SwitchEven( 6) SwitchOdd( 5) SwitchEven( 4) \
  55.     SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
  56.     } \
  57.     while ((nl -= UNROLL) >= 0) { \
  58.     LoopReset \
  59.     BodyEven( 8) \
  60.         BodyOdd( 7) BodyEven( 6) BodyOdd( 5) BodyEven( 4) \
  61.         BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
  62.     }
  63. #else
  64. #define UNROLL 4
  65. #define PackedLoop \
  66.     switch (nl & (UNROLL-1)) { \
  67.     SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
  68.     } \
  69.     while ((nl -= UNROLL) >= 0) { \
  70.     LoopReset \
  71.         BodyEven( 4) \
  72.         BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
  73.     }
  74. #endif
  75.  
  76. #define DuffL(counter,label,body) \
  77.     switch (counter & 3) { \
  78.     label: \
  79.         body \
  80.     case 3: \
  81.     body \
  82.     case 2: \
  83.     body \
  84.     case 1: \
  85.     body \
  86.     case 0: \
  87.     if ((counter -= 4) >= 0) \
  88.         goto label; \
  89.     }
  90. @
  91.